Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape invalid XML chars in testCase and testSuite names #284

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

sfc-gh-abalik
Copy link
Contributor

@sfc-gh-abalik sfc-gh-abalik commented Jun 24, 2024

Fix for #285

With a ParameterizedTest it is possible to generate test case names with invalid XML characters. E.g.

@ParameterizedTest
@ValueSource(strings = {"Weird\bname"})
void testFoo(String input) {
    ...
}

The test case name is derived from the input string, which in this case contains an invalid XML char \b. When tools (like IDEs) try to parse the junit XML, they'll fail due to the invalid char.

Fix it by escaping test case names. It looks like test suite names could also contain invalid XML chars, so I'm escaping those as well.

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@illicitonion
Copy link
Collaborator

The CI failure is spurious, but is blocked on bazel-contrib/rules_jvm_external#1173 getting released - hopefully it will get released soon!

@sfc-gh-abalik
Copy link
Contributor Author

Looks like bazel-contrib/rules_jvm_external#1173 got released.
I think we just need to rebase after #288 is merged.

@shs96c
Copy link
Collaborator

shs96c commented Jul 12, 2024

@sfc-gh-abalik, with #288 we now have the CI builds working properly again. Could you please rebase on top of current HEAD of main so that we can land this change? Thank you for your patience as we were sorting that out!

Copy link
Collaborator

@shs96c shs96c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@shs96c shs96c merged commit a78287a into bazel-contrib:main Jul 29, 2024
8 checks passed
@sfc-gh-abalik sfc-gh-abalik deleted the abalik-escape-illegal-chars branch July 29, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants